﻿<?php
// ------------------------------------------------------------------
// NEEDED STUBS FOR THIS EXAMPLE
// ------------------------------------------------------------------


// this will include all needed files to be able to build a Request
include_once($CONF["STUBS_FOLDER"]."Map24MapletRemoteControl/Map24MapletRemoteControl.php5");


// ------------------------------------------------------------------
// NEEDED PARAMETERS FOR THIS REQUEST
// ------------------------------------------------------------------


//coordinates of the Oval to add
$longitude 	= "598.3";
$latitude 	= "3213.0068";
$width		= "3000";
$height		= "3000";

//Color of the Oval (Fillcolor)
$FillColor['red'] = 255;
$FillColor['green'] = 0;
$FillColor['blue'] = 0;
$FillColor['alpha'] = 30;

//Color of the Border (Bordercolor)
$BorderColor['red'] = 0;
$BorderColor['green'] = 0;
$BorderColor['blue'] = 255;
$BorderColor['alpha'] = 255;

// zoomlevel
$mapViewClippingWidth = 1000;

// discription
$discription = "Oval Hamburg";


// ------------------------------------------------------------------
// BUILDING THE REQUEST
// ------------------------------------------------------------------


// here are all commands defined and are put together in one ArrayOfCommands

// this object will add a new Oval
$cmdIdx=0;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->DeclareMap24Oval = new DeclareMap24Location();
$commands[$cmdIdx]->DeclareMap24Oval->MapObjectID = "Oval";
$commands[$cmdIdx]->DeclareMap24Oval->Center = new Coordinate();
$commands[$cmdIdx]->DeclareMap24Oval->Center->Longitude = $longitude;
$commands[$cmdIdx]->DeclareMap24Oval->Center->Latitude = $latitude;
$commands[$cmdIdx]->DeclareMap24Oval->Width= $width;
$commands[$cmdIdx]->DeclareMap24Oval->Height= $height;
$commands[$cmdIdx]->DeclareMap24Oval->FillColor = new Color();
$commands[$cmdIdx]->DeclareMap24Oval->FillColor->red = $FillColor['red'];
$commands[$cmdIdx]->DeclareMap24Oval->FillColor->green = $FillColor['green'];
$commands[$cmdIdx]->DeclareMap24Oval->FillColor->blue = $FillColor['blue'];
$commands[$cmdIdx]->DeclareMap24Oval->FillColor->alpha = $FillColor['alpha'];
$commands[$cmdIdx]->DeclareMap24Oval->BorderColor = new Color();
$commands[$cmdIdx]->DeclareMap24Oval->BorderColor->red = $BorderColor['red'];
$commands[$cmdIdx]->DeclareMap24Oval->BorderColor->green = $BorderColor['green'];
$commands[$cmdIdx]->DeclareMap24Oval->BorderColor->blue = $BorderColor['blue'];
$commands[$cmdIdx]->DeclareMap24Oval->BorderColor->alpha = $BorderColor['alpha'];
$commands[$cmdIdx]->DeclareMap24Oval->Description = $description;

// this object will enable the new Oval on the map
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->ControlMapObject = new ControlMapObject();
$commands[$cmdIdx]->ControlMapObject->Control = "SHOW";
$commands[$cmdIdx]->ControlMapObject->MapObjectIDs = array("Oval");

// this object will center the map above the new Oval
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->SetMapView = new SetMapView();
$commands[$cmdIdx]->SetMapView->MapObjectIDs = array("Oval");
$commands[$cmdIdx]->SetMapView->ClippingWidth = new SetMapViewClippingWidth();
$commands[$cmdIdx]->SetMapView->ClippingWidth->MinimumWidth = $mapViewClippingWidth;

// definition of the request header with Map24ID and SessionID
$header = new RequestHeader();
$header->Map24ID  = $CONF['MAP24_ID'];
$header->ClientID = $CONF['SESSION_ID'];

// definition of the request body
$request = new MapletRemoteControlRequest();
$request->Map24MRC = new Map24MRC();
$request->Map24MRC->Commands = $commands;


// ------------------------------------------------------------------
// EXECUTE THE REQUEST
// ------------------------------------------------------------------


// in this object the SoapClient will be initiated and executed
$mrc = new Map24MapletRemoteControl($CONF['MAPTP_SYSTEM'],$CONF['MAP24_ID'],$CONF['SESSION_ID']);
$response = $mrc->mapletRemoteControl($header,$request);


// ------------------------------------------------------------------
// OUTPUT THE RESULT
// ------------------------------------------------------------------


$resultString = "This command generates no output";
$counter = 0;
?>